//
//  Page1.m
//  TestSwitchView
//
//  Created by Jacky Zhang on 11-4-19.
//  Copyright 2011年 __MyCompanyName__. All rights reserved.
//

#import "Page1.h"


@implementation Page1

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)dealloc
{
    [super dealloc];
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

- (IBAction) goToPage2: (id)sender {
//    [self.view removeFromSuperview];
    Page2 *p2 = [[Page2 alloc] initWithNibName:@"Page2" bundle:nil];
    [UIView beginAnimations:@"animationID" context:nil];
    [UIView setAnimationDuration:0.8f];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
    [UIView setAnimationRepeatAutoreverses:NO];
    [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view.window cache:YES];
    [self.view addSubview:p2.view];
    [UIView commitAnimations];}

- (IBAction) backToHome: (id)sender {
    [self.view removeFromSuperview];
//    TestSwitchViewViewController *home = [[TestSwitchViewViewController alloc] initWithNibName:@"TestSwitchViewViewController" bundle:nil];
//    [self.view addSubview:home.view];
//    [home release];
}



@end
